import request from './request'

// 报名活动
export function registerActivity(data) {
  return request.post('/registrations', data)
}

// 取消报名
export function cancelRegistration(id) {
  return request.delete(`/registrations/${id}`)
}

// 更新报名状态
export function updateRegistrationStatus(id, data) {
  return request.put(`/registrations/${id}/status`, data)
}

// 批量更新报名状态
export function batchUpdateRegistrationStatus(data) {
  return request.put('/registrations/batch/status', data)
}

// 活动签到
export function checkInRegistration(id) {
  return request.put(`/registrations/${id}/check-in`)
}

// 检查是否已报名
export function checkRegistration(activityId) {
  return request.get(`/registrations/check/${activityId}`)
}

// 获取报名状态
export function getRegistrationStatus(activityId) {
  return request.get(`/registrations/check/${activityId}`)
}

// 获取活动的报名记录
export function getActivityRegistrations(params) {
  return request.get('/registrations/activity', { params })
}

// 获取用户的报名记录
export function getUserRegistrations(params) {
  return request.get('/registrations/user', { params })
}